package com.ruoyi.cms.service.impl;

import com.ruoyi.cms.domain.CmsLoopAction;
import com.ruoyi.cms.mapper.CmsLoopActionMapper;
import com.ruoyi.cms.service.ICmsLoopActionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 轮播广告Service业务层处理
 *
 * @author houyong
 * @date 2025-11-08
 */
@Service
public class CmsLoopActionServiceImpl implements ICmsLoopActionService {
    @Autowired
    private CmsLoopActionMapper cmsLoopActionMapper;

    /**
     * 查询轮播广告
     *
     * @param id 轮播广告主键
     * @return 轮播广告
     */
    @Override
    public CmsLoopAction selectCmsLoopActionById(Long id) {
        return cmsLoopActionMapper.selectCmsLoopActionById(id);
    }

    /**
     * 查询轮播广告列表
     *
     * @param cmsLoopAction 轮播广告
     * @return 轮播广告
     */
    @Override
    public List<CmsLoopAction> selectCmsLoopActionList(CmsLoopAction cmsLoopAction) {
        return cmsLoopActionMapper.selectCmsLoopActionList(cmsLoopAction);
    }

    /**
     * 新增轮播广告
     *
     * @param cmsLoopAction 轮播广告
     * @return 结果
     */
    @Override
    public int insertCmsLoopAction(CmsLoopAction cmsLoopAction) {
        return cmsLoopActionMapper.insertCmsLoopAction(cmsLoopAction);
    }

    /**
     * 修改轮播广告
     *
     * @param cmsLoopAction 轮播广告
     * @return 结果
     */
    @Override
    public int updateCmsLoopAction(CmsLoopAction cmsLoopAction) {
        return cmsLoopActionMapper.updateCmsLoopAction(cmsLoopAction);
    }

    /**
     * 批量删除轮播广告
     *
     * @param ids 需要删除的轮播广告主键
     * @return 结果
     */
    @Override
    public int deleteCmsLoopActionByIds(Long[] ids) {
        return cmsLoopActionMapper.deleteCmsLoopActionByIds(ids);
    }

    /**
     * 删除轮播广告信息
     *
     * @param id 轮播广告主键
     * @return 结果
     */
    @Override
    public int deleteCmsLoopActionById(Long id) {
        return cmsLoopActionMapper.deleteCmsLoopActionById(id);
    }

    @Override
    public int updateStatus(CmsLoopAction cmsLoopAction) {
        return cmsLoopActionMapper.updateStatus(cmsLoopAction.getId(), cmsLoopAction.getStatus());
    }

    @Override
    public int updateSortBatch(List<CmsLoopAction> loopActions) {
        return cmsLoopActionMapper.updateSortBatch(loopActions);
    }


}
